package pl.kedziorski.timesurvey;

import java.util.concurrent.TimeUnit;

public enum SurveyResultFormat {
	MILISECONDS{
		@Override
		public String format(long time) {
			return time + "ms";
		}
		
	},
	SECONDS {
		@Override
		public String format(long time) {
			return TimeUnit.MILLISECONDS.toSeconds(time)+" sec";
		}
	},
	MINUTES {
		@Override
		public String format(long time) {
			return TimeUnit.MILLISECONDS.toMinutes(time)+" min";
		}
	},
	SEC_MILI {
		@Override
		public String format(long time) {
			return TimeUnit.MILLISECONDS.toSeconds(time)+" sec, " + (time % 1000) + "ms";
		}
	},
	MIN_SEC {
		@Override
		public String format(long time) {
			return TimeUnit.MILLISECONDS.toMinutes(time)+" min, " + (TimeUnit.MILLISECONDS.toSeconds(time) % 60) + " sec";
		}
	},
	MIN_SEC_MILI {
		@Override
		public String format(long time) {
			return TimeUnit.MILLISECONDS.toMinutes(time)+" min, " + (TimeUnit.MILLISECONDS.toSeconds(time) % 60) + " sec, " + (time % 1000) + " ms";
		}
	};
	
	public abstract String format(long time);
}
